package com.sks.bean.pojo;

import static javax.persistence.GenerationType.IDENTITY;


import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;


/**
 * @className Feature 
 * @author yjy
 * @todate 2011-11-7
 */
@Entity
@Table(name = "feature", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
public class Feature implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer featureId;
	private String name;
	private String description;
	private String imgFilePath;
	private Date createTime;
	private Integer tabIndex;
	private Boolean visible;
	private Set<News> news = new HashSet<News>(0);

	// Constructors

	/** default constructor */
	public Feature() {
	}

	/** minimal constructor */
	public Feature(Integer featureId, String name, Date createTime, Boolean visible) {
		this.featureId = featureId;
		this.name = name;
		this.createTime = createTime;
		this.visible = visible;
	}

	/** full constructor */
	public Feature(Integer featureId,String name, String description, String imgFilePath,
			Date createTime, Integer tabIndex, Boolean visible, Set<News> newses) {
		this.featureId = featureId;
		this.name = name;
		this.description = description;
		this.imgFilePath = imgFilePath;
		this.createTime = createTime;
		this.tabIndex = tabIndex;
		this.visible = visible;
		this.news = newses;
	}

	// Property accessors

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name="featureId",unique = true, nullable = false)
	public Integer getFeatureId() {
		return this.featureId;
	}

	public void setFeatureId(Integer featureId) {
		this.featureId = featureId;
	}

	@Column(name = "name", unique = true, nullable = false, length = 20)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(length=300)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(length=200)
	public String getImgFilePath() {
		return this.imgFilePath;
	}

	public void setImgFilePath(String imgFilePath) {
		this.imgFilePath = imgFilePath;
	}

	@Temporal(TemporalType.DATE) @Column(nullable=false)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(length=11)
	public Integer getTabIndex() {
		return this.tabIndex;
	}

	public void setTabIndex(Integer tabIndex) {
		this.tabIndex = tabIndex;
	}

	@Column(length=200,nullable=false)
	public Boolean getVisible() {
		return this.visible;
	}

	public void setVisible(Boolean visible) {
		this.visible = visible;
	}

	@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "feature")
	public Set<News> getNewses() {
		return this.news;
	}

	public void setNewses(Set<News> newses) {
		this.news = newses;
	}

}